<template>
  <div class="content-area" :style="{height: `calc(100vh - ${marginHeight - 34 - ((title && detailTitle) ? 0 : -40) }px)`}">
    <div :class="borderStyle()">
      <div class="lt b"></div>
      <div class="rt b"></div>
      <div class="rb b"></div>
      <div class="lb b"></div>
      <div class="content-area-tBox">
        <span style="color: #5cd9e8;">
<!--          <icon name="chart-line"></icon>-->
        </span>
        <div class="content-area-title" :style="{
          display: (title && detailTitle) ? 'block' : 'none'
        }">
          <span class="blueBorder"></span>
          {{ title }}

        </div>
        <span class="content-area-rightDetail">
          <a v-show="isDetail" class="detailBtn" @click="detailHandle"
             href="javascript: void(0);">
                      {{ detailTitle }}
            <!--            <i class="el-icon-more"></i>-->
                    </a>
           <slot name="right"></slot>
        </span>
      </div>
      <div class="content-area-body" :style="{height: `calc(100vh - ${marginHeight + 20}px)`}">
        <slot name="center"></slot>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
const emit = defineEmits(['clickA'])
const props = defineProps({
  title: {
    type: String,
    default: "",
  },
  marginHeight: {
    type: Number,
    default: 140,
  },
  isDetail: {
    type: Boolean,
    default: false,
  },
  detailTitle: {
    type: String,
    default: '查看更多'
  },
  border: {
    type: Number,
    default: 1,
  },
})

const borderStyle = () => {
  let str = 'content-area-bg'
  return str + props.border
}

const detailHandle = () => {
  emit('clickA')
}
</script>

<style lang="scss" scoped>
@import "@/assets/var";
.content-area {
  display: flex;
  position: relative;
  //margin-left: 20px;
  //margin-top: 10px;
  //margin-right: 26px;
  width: 100%;
  //padding: 0.2rem;
  border-radius: 10px;

  // 当换不同的主题时需调整该处，以适应主题背景，注意，无backdrop-filter时请删除
  background: $--detail-box-bg;
  backdrop-filter: $--detail-box-backdrop-filter;


  &::before {
    content: unset;
  }

  //@supports (background: -moz-element(#bg)) {
  //  & {
  //    background: rgba(75, 108, 183, 0.95);
  //  }
  //}

  &-bg1 {
    width: 100%;
    height: 100%;
    background: linear-gradient(#00faff, #00faff) left top,
    linear-gradient(#00faff, #00faff) left top,
    linear-gradient(#00faff, #00faff) right top,
    linear-gradient(#00faff, #00faff) right top,
    linear-gradient(#00faff, #00faff) left bottom,
    linear-gradient(#00faff, #00faff) left bottom,
    linear-gradient(#00faff, #00faff) right bottom,
    linear-gradient(#00faff, #00faff) right bottom;
    background-repeat: no-repeat;
    background-size: 5px 20px, 20px 5px;

    & > div.b {
      display: none;

    }

  }

  &-bg2 {
    position: absolute;
    width: 100%;
    height: 100%;


    & > div.b {
      width: 10px;
      height: 10px;
      position: absolute;
    }
  }

  &-bg3 {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 1px solid $--detail-box-color;


    & > div.b {
      width: 10px;
      height: 10px;
      position: absolute;
    }

    .lt {
      border-top: 3px solid $--detail-box-color;
      border-left: 3px solid $--detail-box-color;
      left: -3px;
      top: -3px;
    }

    .rt {
      border-top: 3px solid $--detail-box-color;
      border-right: 3px solid $--detail-box-color;
      right: -3px;
      top: -3px;
    }

    .rb {
      border-bottom: 3px solid $--detail-box-color;
      border-right: 3px solid $--detail-box-color;
      right: -3px;
      bottom: -3px;
    }

    .lb {
      border-bottom: 3px solid $--detail-box-color;
      border-left: 3px solid $--detail-box-color;
      left: -3px;
      bottom: -3px;
    }
  }

  &-bg4 {
    width: 100%;
    height: 100%;

    & > div.b {
      display: none;

    }
  }

  &-title {
    padding: $--detail-box-title-margin;
    text-align: left;
    display: block;
    width: 100%;
    height: $--detail-box-title-height;
    line-height: $--detail-box-title-height;
    font-size: $--detail-box-title-size;
    font-weight: 550;
    color: $--detail-box-color;

    .blueBorder {
      border: 3px solid $themeColor;
      border-radius: 0px 3px 3px 0px;
      height: 16px;
      display: inline-block;
      position: relative;
      top: 2px;
      left: -8px;
    }
  }

  &-rightDetail {
    position: absolute;
    top: 16px;
    right: 38px;
    cursor: pointer;

    .detailBtn {
      cursor: pointer;
      font-size: $--detail-box-btn-size;
      color: $--detail-box-title-bg-color;
    }
  }

  &-body {
    overflow: hidden;
    border-radius: 0.125rem;
    color: #ffffffe6;
  }
}
</style>

